-
Notifications
You must be signed in to change notification settings - Fork 40.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BS-157] Add support for MultipartConfig #2
Conversation
To support Multipart uploads, add ability to turn on some beans and servlet support if user includes a MultipartConfigElement in the app context.
Update EmbeddedWebApplicationContext to obtain ServletContextInitializer beans after self initialization. Allows @configuration beans to be ServletContextAware.
Polish pom.xml formatting and pull version numbers into parent pom when possible.
Update OnBeanCondition and OnMissingBeanCondition to work better with @configuration classes and to support an optional considerHierarchy annotation value. The class value for conditions can now also be inferred when used on @bean methods.
Update EnableAutoConfigurationImportSelector to sort auto-configuration classes based on @order and @AutoConfigureAfter annotations.
Refactor JpaComponentScanDetector to a more general use utility and ensure that details are always stored.
Polish and fixup: - Ordered auto-configuration - @ConditionalOnBean default on @bean methods - Improved separation of auto-configure classes - Consistent naming - Javadoc, code formatting and tests
Numerous changes to the actuator project, including: - Specific Endpoint interface - Spring MVC/Enpoint adapter - Management server context changes - Consistent auto-configuration class naming - Auto-configuration ordering - Javadoc, code formatting and tests
I'm not comforatble with the container-specific code, so I think we need to abandon that here and switch to using |
User can set spring.template.cache=false to change the behaviour
I'm not sure about how to use ServletRegistrationBean by itself, hence I don't know how to modify it in this context to add extra support. |
The The |
Begging your pardon, but how do I wire up a minimal embedded setup using that for test purposes? So far, I have the following code, but I don't know how to bridge that to either @Test
public void containerWithAutomatedMultipartTomcatConfiguration() {
this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithEverythingTomcat.class,
MultipartAutoConfiguration.class);
try {
assertNotNull(this.context.getBean(MultipartConfigElement.class));
assertNotNull(this.context.getBean(StandardServletMultipartResolver.class));
} finally {
this.context.close();
}
}
@Configuration
public static class ContainerWithEverythingTomcat {
@Bean
MultipartConfigElement multipartConfigElement() {
return new MultipartConfigElement("");
}
@Bean
TomcatEmbeddedServletContainerFactory containerFactory() {
return new TomcatEmbeddedServletContainerFactory();
}
} |
Breakthrough! Since I updated my test code with this: this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithEverythingTomcat.class,
WebMvcAutoConfiguration.class,
MultipartAutoConfiguration.class); ...it seems the servlet is getting created and I can see my tweaks working. Let me work on this some more, and I might have an updated patch to inspect on Monday. |
To support Multipart uploads, add ability to turn on some beans and servlet support if user includes a MultipartConfigElement in the app context.
Make final edits
Support an alternative fat jar format that is more amenable to Docker image layers. The new format arranges files in the following structure: BOOT-INF/ layers/ <layer-name #1> /classes /lib <layer-name #2> /classes /lib The `BOOT-INF/layers.idx` file provides the names of the layers and the order in which they should be added (starting with the least changed). The `JarLauncher` class can load layered jars in both fat and exploded forms. Closes gh-19767 Co-authored-by: Phillip Webb <pwebb@pivotal.io>
This pull request is for review purposes only. This patch is by no means complete.
To support Multipart uploads, add ability to turn on some beans and servlet support if user includes a MultipartConfigElement in the app context.